package com.design.decorator.coffee;

public class DecoratorDemo {
    public static void main(String[] args) {
        // 点一杯浓缩咖啡
        Coffee espresso = new Espresso();
        System.out.println("Coffee: " + espresso.getDescription());
        System.out.println("Cost: $" + espresso.getCost());

        // 加入牛奶和巧克力
        CoffeeDecorator latteWithMilkAndChocolate = new ChocolateDecorator(new MilkDecorator(new Latte()));
        System.out.println("\nCoffee: " + latteWithMilkAndChocolate.getDescription());
        System.out.println("Cost: $" + latteWithMilkAndChocolate.getCost());

        // 加入糖浆
        CoffeeDecorator mochaWithSyrup = new SyrupDecorator(new Mocha());
        System.out.println("\nCoffee: " + mochaWithSyrup.getDescription());
        System.out.println("Cost: $" + mochaWithSyrup.getCost());
    }
}
